layui.define(function (exports) {

    layui.use(['pub', 'jquery', 'layer','laydate'], function () {
        var layer = layui.layer;
        var $ = layui.jquery;
        var pub = layui.pub;
        var laydate = layui.laydate;
        var obj = {
            getUserTokenId: function () {
                //获取用户令牌
                return layui.data(SYS_SESSION['TOKENID_SESSION']).TOKENID_SESSION;
            },
            setUserTokenId: function (tokenId) {
                //将用户登录令牌写入缓存
                layui.data(SYS_SESSION['TOKENID_SESSION'], {
                    key: SYS_SESSION['TOKENID_SESSION'],
                    value: tokenId});
            },
            getUserInfo: function () {
                //获取缓存中用户信息
                return layui.data(SYS_SESSION['USER_SESSION']).USER_SESSION;
            },
            setUserInfo: function (user) {
                //将登录用户信息写入缓存
                layui.data(SYS_SESSION['USER_SESSION'], {
                    key: SYS_SESSION['USER_SESSION'],
                    value: user});
            },
            signRequest:function(){
                //生成hmac
                var encrypt = new JSEncrypt();
                encrypt.setPublicKey(shopxPublicRSAKey);
                var tokenId = this.getUserTokenId();
                var userId = this.getUserInfo().userId;
                var cpId = this.getUserInfo().cpId;
                var originalHmac = userId + ":" + tokenId + ":" + cpId;
                var hmac = encrypt.encrypt(originalHmac);
                return hmac;
            },
            eleAuthShow:function(eleAuthArray){
                //展示登录用户有权限的菜单
                var eleObj = new Array();
                $(".ele-auth").each(function () {
                    eleObj.push($(this).attr('id'));
                });
                for(var i=0;i<eleObj.length;i++){
                    var ele = eleObj[i];
                    for(var j=0;j<eleAuthArray.length;j++){
                        if(ele==eleAuthArray[j].eleId){
                            $("#" + ele).show();
                            break;
                        }
                    }
                }
            },
            getDictByCodeName:function(dictCode,dictName){
                var dictList =  layui.data(SYS_SESSION['SYS_DICT']).SYS_DICT;
                for (var i = 0; i < dictList.length; i++) {
                    if ((dictList[i].dictCode == dictCode) && (dictName == dictList[i].dictName)) {
                        return dictList[i].dictValue;
                    }
                }
            },
            getDictByCode:function(dictCode){
                var dictList =  layui.data(SYS_SESSION['SYS_DICT']).SYS_DICT;
                // console.info("aa:"+JSON.stringify(dictList));
                var dictArry = new Array();
                var i = 0;
                $(dictList).each(function (idx, item) {
                    if (item.dictCode == dictCode) {
                        dictArry[i]=item;
                        i++;
                    }
                });
                return dictArry;
                // console.info("bb:"+JSON.stringify(dictArry));
            },
            genPage:function(page){
                var componentName = page.name;
                // var controlName = page.controlName;
                // //查询列表接口
                // page['qryUrl'] = '/'+controlName+'/queryPageList';
                // //查询明细接口
                // page['detUrl'] = '/'+controlName+'/queryOneByPrimaryKey';
                // //新增接口
                // page['addUrl'] = '/'+controlName+'/insertOne';
                // //修改接口
                // page['updUrl'] = '/'+controlName+'/updateOne';
                // //删除接口
                // page['delUrl'] = '/'+controlName+'/deleteChecked';
                // //批量删除接口
                // page['delBatchUrl'] = '/'+controlName+'/deleteBatch';
                // //导出接口
                // page['downloadUrl'] = '/'+controlName+'/download';
                //查询条件
                page['conName'] = componentName+'ConForm';
                //按钮
                page['btnName'] =componentName+'BtnForm';
                //表格id
                page['tableName'] =componentName+'Table';
                //表单Id
                page['formName'] =componentName+'Form';
                return page;
            },
            genCond:function(page){
                var that = this;
                //生成条件元素
                //注意：如果类型是DICT 则用:分割 [0]是id [1]是dictCode,[2]是类型（t1：普通下拉框；t2:搜索下拉框；t3:多选搜索下拉框）
                $("#"+page.conName).html('');
                $(page.conArray).each(function (idx, item) {
                    //label
                    var label = item.split('|')[0];
                    //编号
                    var id = item.split('|')[1];
                    //类型
                    var type = item.split("|")[2];
                    //是否展示请选择
                    var emptyOptionFlag = item.split("|")[3];

                    if(type=='TEXT'){
                        $("#"+page.conName).append('<div class="layui-col-xs3">\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">'+label+'</label>\n' +
                            '                <div class="layui-input-block">\n' +
                            '                    <input type="text" id="q_'+page.prefix+"_"+id+'" name="q_'+page.prefix+"_"+id+'"\n' +
                            '                           lay-filter="q_'+page.prefix+"_"+id+'" class="layui-input" autocomplete="off" style="width: 90%"/>\n' +
                            '                    <i class="i-icon delete-icon"></i>\n' +
                            '                </div>\n' +
                            '            </div>\n' +
                            '        </div>');
                    }else if(type=='DICT'){
                        var dictId = id.split(":")[0];
                        var dictCode = id.split(":")[1];
                        var dictType = id.split(":")[2];
                        var searchOption = "";
                        if(dictType=="t2"){
                            searchOption = 'lay-search=""';
                        }

                        var dictArry = that.getDictByCode(dictCode);
                        var optionList = "";
                        if(!pub.isEmpty(emptyOptionFlag) && emptyOptionFlag=="Y"){
                        }else{
                            optionList = "<option value=''>请选择</option>";
                        }
                        $(dictArry).each(function (idx, item) {
                            optionList+='<option value="'+item.dictName+'">'+item.dictValue+'</option>';
                        });
                        $("#"+page.conName).append('<div class="layui-col-xs3">\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">'+label+'</label>\n' +
                            '                <div class="layui-input-block">\n' +
                            '                    <select  id="q_'+page.name+"_"+dictId+'" style="width: 90%" name="q_'+page.prefix+"_"+dictId+'" lay-filter="q_'+page.prefix+"_"+dictId+'" '+searchOption+'>\n' +
                            optionList +
                            '</select>'+
                            '                </div>\n' +
                            '            </div>\n' +
                            '        </div>');
                    }else if(type=='SEL'){
                        var selId = id.split(":")[0];
                        var selType = id.split(":")[1];
                        var searchOption = "";
                        if(selType=="t2"){
                            searchOption = 'lay-search=""';
                        }else if(selType=="t3"){
                            searchOption = 'xm-select-search="" xm-select="q_'+page.prefix+"_"+selId+'"';
                        }
                        var optionList = "";
                        if(!pub.isEmpty(emptyOptionFlag) && emptyOptionFlag=="Y"){
                        }else{
                            optionList = "<option value=''>请选择</option>";
                        }
                        $("#"+page.conName).append('<div class="layui-col-xs3">\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">'+label+'</label>\n' +
                            '                <div class="layui-input-block">\n' +
                            '                    <select  id="q_'+page.prefix+"_"+selId+'" style="width: 90%" name="q_'+page.prefix+"_"+selId+'" lay-filter="q_'+page.prefix+"_"+selId+'"  '+searchOption+'>\n' +
                            optionList +
                            '</select>'+
                            '                </div>\n' +
                            '            </div>\n' +
                            '        </div>');
                    }else if(type=='DT'){
                        var itemId = id.split(":")[0];
                        var itemType = id.split(":")[1];
                        $("#"+page.conName).append('<div class="layui-col-xs3">\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">'+label+'</label>\n' +
                            '                <div class="layui-input-block">\n' +
                            '                    <input type="text" style="width: 90%" id="q_'+page.prefix+"_"+itemId+'" name="q_'+page.prefix+"_"+itemId+'"\n' +
                            '                           class="layui-input" readonly/>\n' +
                            '                    <i class="i-icon delete-icon"></i>\n' +
                            '                </div>\n' +
                            '            </div>\n' +
                            '        </div>');
                        if(itemType=='d1'){
                            //普通日期下拉框
                            laydate.render({
                                elem: '#q_'+page.prefix+'_'+itemId,
                            });
                        }else if(itemType=='d2'){
                            //日期范围下拉框
                            laydate.render({
                                elem: '#q_'+page.prefix+'_'+itemId,
                                type: 'datetime',
                                range: '~',
                                format: 'yyyyMMdd'
                            });
                        }
                    }else if(type=='DTM'){
                        var itemId = id.split(":")[0];
                        var itemType = id.split(":")[1];
                        $("#"+page.conName).append('<div class="layui-col-xs3">\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">'+label+'</label>\n' +
                            '                <div class="layui-input-block">\n' +
                            '                    <input type="text" style="width: 90%" id="q_'+page.prefix+"_"+itemId+'" name="q_'+page.prefix+"_"+itemId+'"\n' +
                            '                           class="layui-input" readonly/>\n' +
                            '                    <i class="i-icon delete-icon"></i>\n' +
                            '                </div>\n' +
                            '            </div>\n' +
                            '        </div>');
                        if(itemType=='d1'){
                            //普通日期下拉框
                            laydate.render({
                                elem: '#q_'+page.prefix+'_'+itemId,
                                format: 'yyyyMMddHHmmss'
                            });
                        }else if(itemType=='d2'){
                            //日期范围下拉框
                            laydate.render({
                                elem: '#q_'+page.prefix+'_'+itemId,
                                type: 'datetime',
                                range: '~',
                                format: 'yyyyMMddHHmmss'
                            });
                        }
                    }else if(type=='RDT'){
                        var begDt = id.split(":")[0];
                        var endDt = id.split(":")[1];
                        var dtType = id.split(":")[2];
                        $("#"+page.conName).append('<div class="layui-col-xs3">\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">'+label+'</label>\n' +
                            '                <div class="layui-input-block">\n' +
                            '                    <input type="text" style="width: 90%" id="q_'+page.prefix+"_"+begDt+"_"+endDt+'" name="q_'+page.prefix+"_"+begDt+"_"+endDt+'"\n' +
                            '                           class="layui-input" readonly/>\n' +
                            '                    <i class="i-icon delete-icon"></i>\n' +
                            '                </div>\n' +
                            '            </div>\n' +
                            '        </div>');
                        if(dtType=='d1'){
                            //普通日期下拉框
                            laydate.render({
                                elem: '#q_'+page.prefix+'_'+begDt+"_"+endDt,
                            });
                        }else if(dtType=='d2'){
                            //日期范围下拉框
                            laydate.render({
                                elem: '#q_'+page.prefix+'_'+begDt+"_"+endDt,
                                type: 'datetime',
                                range: '~',
                                format: 'yyyyMMdd'
                            });
                        }
                    }else if(type=='RDTM'){
                        var begDt = id.split(":")[0];
                        var endDt = id.split(":")[1];
                        var dtType = id.split(":")[2];
                        $("#"+page.conName).append('<div class="layui-col-xs3">\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">'+label+'</label>\n' +
                            '                <div class="layui-input-block">\n' +
                            '                    <input type="text" style="width: 90%" id="q_'+page.prefix+"_"+begDt+"_"+endDt+'" name="q_'+page.prefix+"_"+begDt+"_"+endDt+'"\n' +
                            '                           class="layui-input" readonly/>\n' +
                            '                    <i class="i-icon delete-icon"></i>\n' +
                            '                </div>\n' +
                            '            </div>\n' +
                            '        </div>');
                        if(dtType=='d1'){
                            //普通日期下拉框
                            laydate.render({
                                elem: '#q_'+page.prefix+'_'+begDt+"_"+endDt,
                                format: 'yyyyMMddHHmmss'
                            });
                        }else if(dtType=='d2'){
                            //日期范围下拉框
                            laydate.render({
                                elem: '#q_'+page.prefix+'_'+begDt+"_"+endDt,
                                type: 'datetime',
                                range: '~',
                                format: 'yyyyMMddHHmmss'
                            });
                        }
                    }
                });
            },
            genBtn:function(page){
                //生成按钮元素
                $("#"+page.btnName).html('');
                $(page.btnArray).each(function (idx, item) {
                    var id = item.split('|')[0];
                    //名称
                    var name = item.split('|')[1];
                    //类型
                    var type = item.split('|')[2];
                    //图标
                    var icon = item.split('|')[3];
                    //是否权限控制
                    var auth = item.split('|')[4];
                    if(auth!=null && auth=="Y"){
                        $("#"+page.btnName).append(' <button type="button" class="layui-btn layui-btn-'+type+' ele-auth" lay-submit="" id="b_'+page.prefix+"_"+id+'"><i\n' +
                            '                            class="layui-icon">'+icon+'</i>'+name+'\n' +
                            '                    </button>');
                    }else{
                        $("#"+page.btnName).append(' <button type="button" class="layui-btn layui-btn-'+type+'" lay-submit="" id="b_'+page.prefix+"_"+id+'"><i\n' +
                            '                            class="layui-icon">'+icon+'</i>'+name+'\n' +
                            '                    </button>');
                    }
                });
            },
            genForm:function(page){
                //生成表单元素
                var that = this;
                // $("#"+formId).html('');
                //注意：如果类型是DICT 则用:分割 [0]是id [1]是dictCode,[2]是类型（t1：普通下拉框；t2:搜索下拉框；t3:多选搜索下拉框）
                var editHtml='<form class="layui-form" action="" id="'+page.formName+'" style="display: block" lay-filter=\''+page.formName+'\'><div class="layui-row" style="margin-top: 15px;margin-bottom: 15px;">';
                $(page.formArray).each(function (idx, item) {
                    //label|id|类型|是否必填
                    var label = item.split('|')[0];
                    //id
                    var id = item.split('|')[1];
                    //类型
                    var type = item.split('|')[2];
                    //nec
                    var nec = item.split('|')[3];
                    //readOnly
                    var read = item.split('|')[4];
                    // console.info("nec:"+nec);
                    var necStr = " ";
                    var necStar = " ";
                    var readStar = " ";
                    if(!pub.isEmpty(nec) && nec=="Y"){
                        necStr =' lay-verify="required" ';
                        necStar  = '<span style="color: red">  *</span>'
                    }
                    if(!pub.isEmpty(read) && read=="Y"){
                        readStar  =' readonly ';
                    }
                    if(type=="HIDDEN"){
                        //隐藏
                        editHtml +='<input type="hidden" id="f_'+page.prefix+"_"+id+'" name="f_'+page.prefix+"_"+id+'"/>';
                    }else if(type=="TEXT"){
                        //文本
                        editHtml +='<div class="layui-col-xs6">\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">'+label+necStar+'</label>\n' +
                            '                <div class="layui-input-inline">\n' +
                            '                    <input type="text" id="f_'+page.prefix+"_"+id+'" name="f_'+page.prefix+"_"+id+'" lay-filter="f_'+page.prefix+"_"+id+'" '+necStr+ readStar +' autocomplete="off"\n' +
                            '                           class="layui-input">\n' +
                            '                </div>\n' +
                            '            </div>\n' +
                            '        </div>';
                    }else if(type=="NUMBER"){
                        //数字
                        editHtml +='<div class="layui-col-xs6">\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">'+label+necStar+'</label>\n' +
                            '                <div class="layui-input-inline">\n' +
                            '                    <input type="number" id="f_'+page.prefix+"_"+id+'" name="f_'+page.prefix+"_"+id+'" lay-filter="f_'+page.prefix+"_"+id+'" '+necStr+ readStar +' autocomplete="off"\n' +
                            '                           class="layui-input">\n' +
                            '                </div>\n' +
                            '            </div>\n' +
                            '        </div>';
                    } else if(type=="DICT"){
                        //字典
                        var dictId = id.split(":")[0];
                        var dictCode = id.split(":")[1];
                        var dictType = id.split(":")[2];
                        var searchOption = "";
                        if(dictType=="t2"){
                            searchOption = 'lay-search=""';
                        }
                        var dictArry = that.getDictByCode(dictCode);
                        var optionList = "<option value=''>请选择</option>";
                        $(dictArry).each(function (idx, item) {
                            optionList+='<option value="'+item.dictName+'">'+item.dictValue+'</option>';
                        });
                        editHtml +='<div class="layui-col-xs6">\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">'+label+necStar+'</label>\n' +
                            '                <div class="layui-input-inline">\n' +
                            '                    <select  id="f_'+page.prefix+"_"+dictId+'" name="f_'+page.prefix+"_"+dictId+'" lay-filter="f_'+page.prefix+"_"+dictId+'" '+necStr+ readStar +searchOption+'>\n' +
                            optionList +
                            '</select>'+
                            '                </div>\n' +
                            '            </div>\n' +
                            '        </div>';
                    }else if(type=='SEL'){
                        //下拉框
                        var selId = id.split(":")[0];
                        var selType = id.split(":")[1];
                        var searchOption = "";
                        if(selType=="t2"){
                            searchOption = ' lay-search="" ';
                        }else if(selType=="t3"){
                            searchOption = ' xm-select-search="" xm-select="f_'+page.prefix+"_"+selId+'" ';
                        }
                        var optionList = "<option value=''>请选择</option>";
                        editHtml +='<div class="layui-col-xs6">\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">'+label+necStar+'</label>\n' +
                            '                <div class="layui-input-inline">\n' +
                            '                    <select  id="f_'+page.prefix+"_"+selId+'" name="f_'+page.prefix+"_"+selId+'"  lay-filter="f_'+page.prefix+"_"+selId+'" '+necStr + readStar + searchOption+'>\n' +
                            optionList +
                            '</select>'+
                            '                </div>\n' +
                            '            </div>\n' +
                            '        </div>';
                    }else if(type=='DT' || type=='DTM'){
                        //日期
                        editHtml +='<div class="layui-col-xs6">\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">'+label+necStar+'</label>\n' +
                            '                <div class="layui-input-inline">\n' +
                            '                    <input type="text" id="f_'+page.prefix+"_"+id+'" name="f_'+page.prefix+"_"+id+'" lay-filter="f_'+page.prefix+"_"+id+'" '+necStr+ readStar +searchOption+' autocomplete="off"\n' +
                            '                           class="layui-input" readonly>\n' +
                            '                </div>\n' +
                            '            </div>\n' +
                            '        </div>';
                    }else if(type=='UPIMG'){
                        //单图片上传
                        editHtml +='<div class="layui-col-xs6">\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">'+label+necStar+'</label>\n' +
                            '                <div class="layui-input-inline">\n' +
                            '                   <button type="button" class="layui-btn" id="f_'+page.prefix+"_"+id+'_upload">\n' +
                            '                       <i class="layui-icon layui-icon-upload"></i> '+label+'\n' +
                            '                   </button>'+
                            '                   <div class="layui-upload-list">\n' +
                            '                       <img class="layui-upload-img" id="f_'+page.prefix+"_"+id+'_img" style="width: 100px; height: 100px;" onclick="albumSingleImgs(\'f_'+page.prefix+'_'+id+'_img\')">\n' +
                            '                       <input type="hidden" id="f_'+page.prefix+"_"+id+'" name="f_'+page.prefix+"_"+id+'" lay-filter="f_'+page.prefix+"_"+id+'">\n' +
                            '                   </div>\n' +
                            '                   <div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="f_'+page.prefix+"_"+id+'_process">\n' +
                            '                       <div class="layui-progress-bar" lay-percent=""></div>\n' +
                            '                   </div>'+
                            '                </div>\n' +
                            '            </div>\n' +
                            '        </div>';
                    }else if(type=='UPIMGS'){
                        //多图片上传
                        editHtml +='<div class="layui-row"><div class="layui-col-xs12">\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">'+label+necStar+'</label>\n' +
                            '                <div style="margin-left: 50px;margin-right: 50px;">\n' +
                            '                   <button type="button" class="layui-btn" id="f_'+page.prefix+"_"+id+'_upload">\n' +
                            '                       <i class="layui-icon layui-icon-upload"></i> '+label+'\n' +
                            '                   </button>'+
                            '                   <div id="f_'+page.prefix+"_"+id+'_img"></div>\n' +
                            '                   <input type="hidden" id="f_'+page.prefix+"_"+id+'" name="f_'+page.prefix+"_"+id+'" lay-filter="f_'+page.prefix+"_"+id+'">\n' +
                            '                </div>\n' +
                            '            </div>\n' +
                            '        </div></div>';
                    }else if(type=='UPFILE'){
                        //文件上传
                        editHtml +='<div class="layui-row"><div class="layui-col-xs6">\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">'+label+necStar+'</label>\n' +
                            '                <div style="margin-left: 50px;margin-right: 50px;">\n' +
                            '                   <button type="button" class="layui-btn" id="f_'+page.prefix+"_"+id+'_upload">\n' +
                            '                       <i class="layui-icon layui-icon-upload"></i> '+label+'\n' +
                            '                   </button>'+
                            '                   <div id="f_'+page.prefix+"_"+id+'_file"></div>\n'+
                            '                   <input type="hidden" id="f_'+page.prefix+"_"+id+'" name="f_'+page.prefix+"_"+id+'" lay-filter="f_'+page.prefix+"_"+id+'">\n' +
                            '                </div>\n' +
                            '            </div>\n' +
                            '        </div></div>';
                    }else if(type=='TREE'){
                        //树
                        editHtml +='<div class="layui-col-xs6">\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">'+label+necStar+'</label>\n' +
                            '                <div class="layui-input-inline">\n' +
                            '                   <div id="f_'+page.prefix+"_"+id+'" class="demo-tree-more"></div>'+
                            '                </div>\n' +
                            '            </div>\n' +
                            '        </div>';
                    }
                });
                editHtml+='</div>';
                editHtml+='</form>';
                return editHtml;
            },
            genViewForm:function(page){
                //生成表单元素
                var that = this;
                // $("#"+formId).html('');
                //注意：如果类型是DICT 则用:分割 [0]是id [1]是dictCode,[2]是类型（t1：普通下拉框；t2:搜索下拉框；t3:多选搜索下拉框）
                var editHtml='<form class="layui-form" action="" id="'+page.formName+'" style="display: block" lay-filter=\''+page.formName+'\'><div class="layui-row" style="margin-top: 15px;margin-bottom: 15px;">';
                $(page.formArray).each(function (idx, item) {
                    //label|id|类型|是否必填
                    var label = item.split('|')[0];
                    //id
                    var id = item.split('|')[1];
                    //类型
                    var type = item.split('|')[2];
                    //nec
                    var nec = item.split('|')[3];
                    // console.info("nec:"+nec);
                    var necStr = " ";
                    if(nec=="Y"){
                        necStr =' lay-verify="required" ';
                    }
                    if(type=="HIDDEN"){
                        //隐藏
                        editHtml +='<input type="hidden" id="f_'+page.prefix+"_"+id+'" name="f_'+page.prefix+"_"+id+'"/>';
                    }else if(type=="TEXT"){
                        //文本
                        editHtml +='<div class="layui-col-xs6">\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">'+label+'</label>\n' +
                            '                <div class="layui-input-inline">\n' +
                            '                    <input type="text" id="f_'+page.prefix+"_"+id+'" name="f_'+page.prefix+"_"+id+'" lay-filter="f_'+page.prefix+"_"+id+'" '+necStr+' autocomplete="off"\n' +
                            '                           class="layui-input" readonly>\n' +
                            '                </div>\n' +
                            '            </div>\n' +
                            '        </div>';
                    }else if(type=="NUMBER"){
                        //数字
                        editHtml +='<div class="layui-col-xs6">\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">'+label+'</label>\n' +
                            '                <div class="layui-input-inline">\n' +
                            '                    <input type="number" id="f_'+page.prefix+"_"+id+'" name="f_'+page.prefix+"_"+id+'" lay-filter="f_'+page.prefix+"_"+id+'" '+necStr+' autocomplete="off"\n' +
                            '                           class="layui-input" readonly>\n' +
                            '                </div>\n' +
                            '            </div>\n' +
                            '        </div>';
                    } else if(type=="DICT"){
                        //字典
                        var dictId = id.split(":")[0];
                        var dictCode = id.split(":")[1];
                        var dictType = id.split(":")[2];
                        var searchOption = "";
                        if(dictType=="t2"){
                            searchOption = 'lay-search=""';
                        }
                        var dictArry = that.getDictByCode(dictCode);
                        var optionList = "<option value=''>请选择</option>";
                        $(dictArry).each(function (idx, item) {
                            optionList+='<option value="'+item.dictName+'">'+item.dictValue+'</option>';
                        });
                        editHtml +='<div class="layui-col-xs6">\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">'+label+'</label>\n' +
                            '                <div class="layui-input-inline">\n' +
                            '                    <select disabled id="f_'+page.prefix+"_"+dictId+'" name="f_'+page.prefix+"_"+dictId+'" lay-filter="f_'+page.prefix+"_"+dictId+'" '+necStr+searchOption+'>\n' +
                            optionList +
                            '</select>'+
                            '                </div>\n' +
                            '            </div>\n' +
                            '        </div>';
                    }else if(type=='SEL'){
                        //下拉框
                        var selId = id.split(":")[0];
                        var selType = id.split(":")[1];
                        var searchOption = "";
                        if(selType=="t2"){
                            searchOption = ' lay-search="" ';
                        }else if(selType=="t3"){
                            searchOption = ' xm-select-search="" xm-select="f_'+page.prefix+"_"+selId+'" ';
                        }
                        var optionList = "<option value=''>请选择</option>";
                        editHtml +='<div class="layui-col-xs6">\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">'+label+'</label>\n' +
                            '                <div class="layui-input-inline">\n' +
                            '                    <select disabled id="f_'+page.prefix+"_"+selId+'" name="f_'+page.prefix+"_"+selId+'"  lay-filter="f_'+page.prefix+"_"+selId+'" '+necStr + searchOption+'>\n' +
                            optionList +
                            '</select>'+
                            '                </div>\n' +
                            '            </div>\n' +
                            '        </div>';
                    }else if(type=='DT' || type=='DTM'){
                        //日期
                        editHtml +='<div class="layui-col-xs6">\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">'+label+'</label>\n' +
                            '                <div class="layui-input-inline">\n' +
                            '                    <input type="text" id="f_'+page.prefix+"_"+id+'" name="f_'+page.prefix+"_"+id+'" lay-filter="f_'+page.prefix+"_"+id+'" '+necStr+searchOption+' autocomplete="off"\n' +
                            '                           class="layui-input" readonly>\n' +
                            '                </div>\n' +
                            '            </div>\n' +
                            '        </div>';
                    }else if(type=='UPIMG'){
                        //单图片上传
                        editHtml +='<div class="layui-col-xs6">\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">'+label+'</label>\n' +
                            '                <div class="layui-input-inline">\n' +
                            '                   <div class="layui-upload-list">\n' +
                            '                       <img class="layui-upload-img" id="f_'+page.prefix+"_"+id+'_img" style="width: 100px; height: 100px;" onclick="albumSingleImgs(\'f_'+page.prefix+'_'+id+'_img\')">\n' +
                            '                       <input type="hidden" id="f_'+page.prefix+"_"+id+'" name="f_'+page.prefix+"_"+id+'" lay-filter="f_'+page.prefix+"_"+id+'">\n' +
                            '                   </div>\n' +
                            '                </div>\n' +
                            '            </div>\n' +
                            '        </div>';
                    }else if(type=='UPIMGS'){
                        //多图片上传
                        editHtml +='<div class="layui-row"><div class="layui-col-xs12">\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">'+label+'</label>\n' +
                            '                <div style="margin-left: 50px;margin-right: 50px;">\n' +
                            '                   <div id="f_'+page.prefix+"_"+id+'_img"></div>\n' +
                            '                   <input type="hidden" id="f_'+page.prefix+"_"+id+'" name="f_'+page.prefix+"_"+id+'" lay-filter="f_'+page.prefix+"_"+id+'">\n' +
                            '                </div>\n' +
                            '            </div>\n' +
                            '        </div></div>';
                    }else if(type=='UPFILE'){
                        //文件上传
                        editHtml +='<div class="layui-row"><div class="layui-col-xs6">\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">'+label+'</label>\n' +
                            '                <div style="margin-left: 50px;margin-right: 50px;">\n' +
                            '                   <div id="f_'+page.prefix+"_"+id+'_file"></div>\n'+
                            '                   <input type="hidden" id="f_'+page.prefix+"_"+id+'" name="f_'+page.prefix+"_"+id+'" lay-filter="f_'+page.prefix+"_"+id+'">\n' +
                            '                </div>\n' +
                            '            </div>\n' +
                            '        </div></div>';
                    }else if(type=='TREE'){
                        //树
                        editHtml +='<div class="layui-col-xs6">\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">'+label+'</label>\n' +
                            '                <div class="layui-input-inline">\n' +
                            '                   <div id="f_'+page.prefix+"_"+id+'" class="demo-tree-more"></div>'+
                            '                </div>\n' +
                            '            </div>\n' +
                            '        </div>';
                    }
                });
                editHtml+='</div>';
                editHtml+='</form>';
                return editHtml;
            }
        };
        //输出模块
        exports('shopx', obj);
    });


});